const CityReducer = (
  preState = { city: { name: '北京', id: 110100 }, cityList: [] },
  action = {}
) => {
  const state = { ...preState };
  const { type, payload } = action;
  switch (type) {
    case 'change-city':
      state.city = { ...payload };
      return state;
    case 'change-cityList':
      state.cityList = [...payload];
      return state;
    default:
      return preState;
  }
};

export default CityReducer;
